import Vue from 'vue'
import Vuex from 'vuex'
import VueCookies from 'vue-cookies'

Vue.use(Vuex);





const store = new Vuex.Store({
    state: {
        metaInfo: [
            { title: "医慕" },
            { charset: 'utf-8' },
            { theme: 'theme-color' },

        ],
        launch_dialog: false,
        regist_dialog: false,
        navi_drawer: true,
        dark_mode: false,
        dark_mode_icon: "mdi-moon-waning-crescent",
        theme_primary_color: "#26A69A",
        videoplayer: false,
        videoid: null,
        settings: false,
        videosrc: null,
        twofactorcode: false,
        twofactorcodesettings: false,
    },
    mutations: {
        open_launch_dialog(state) {
            state.launch_dialog = true;
        },
        close_launch_dialog(state) {
            state.launch_dialog = false;
        },
        open_regist_dialog(state) {
            state.regist_dialog = true;
        },
        close_regist_dialog(state) {
            state.regist_dialog = false;
        },
        open_videoplayer(state, n) {
            state.videoplayer = true;
            state.videoid = n;
        },
        open_settings(state) {
            state.settings = true;
        },
        close_settings(state) {
            state.settings = false;
        },
        // change_navi_drawer (state){
        //   state.navi_drawer = !state.navi_drawer;
        // },
        // copy_navi_drawer (state,n){
        //   state.navi_drawer = n;
        // },
        change_dark_mode(state) {
            state.dark_mode = !state.dark_mode;
            if (state.dark_mode_icon == "mdi-white-balance-sunny") {
                state.dark_mode_icon = "mdi-moon-waning-crescent";
            } else {
                state.dark_mode_icon = "mdi-white-balance-sunny";
            }
        },
        chage_primary_color(state, n) {
            state.theme_primary_color = n;
        },
        change_videosrc(state, n) {
            state.videosrc = n;
        },
        CAHNGE_META_INFO(state, metaInfo) {
            state.metaInfo = metaInfo;
        },
        change_twofactorcode(state, n) {
            state.twofactorcode = n;
        },
        change_twofactorcodesettings(state, n) {
            state.twofactorcodesettings = n;
        }
    }
})

export default store